import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../film_list/film_list_view.dart';
import 'film_state.dart';

class FilmLogic extends GetxController with GetTickerProviderStateMixin {
  final FilmState state = FilmState();

  late TabController tabController;

  late List<BadgeTab> badgeTab = [];

  late List<Widget> widgets = [];

  @override
  void onInit() {
    super.onInit();
    tabController = TabController(length: state.tabs.length, vsync: this);
    state.tabs.forEach((tab) {
      badgeTab.add(BadgeTab(text: tab));
    });

    for (int i = 0; i < state.tabs.length; i++) {
      widgets.add(FilmListPage(status: i.toString()));
    }
  }

  @override
  void onReady() {
    super.onReady();
  }

  @override
  void onClose() {
    super.onClose();
    tabController.dispose();
  }
}
